<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head th:replace="~{import :: head}"></head>

<script src="/ckeditor/ckeditor.js"></script>

<body>

  <!-- Header Area wrapper Starts -->
  <head th:replace="~{import :: header}"></head>
  <!-- Header Area wrapper End -->







  <!-- 添加文章-->
  <div id="tonzhi" class="section-padding">
    <div class="container">
      <div class="row">



        <div class="show col-md-12" id="myModal">
          <div class="modal-dialog col-md-12">
            <div class="modal-content col-md-12">

              <div class="modal-body">
                <h4 class="modal-title" align="center" >添加文章页面</h4>



                <div class="alert alert-danger"  role="alert" th:if="${error!=null}"  th:text="${error}" ></div>
                <div class="alert alert-success" role="alert" th:if="${info!=null}"  th:text="${info}" ></div>


                <br/>

                <form class="form-horizontal" role="form" action="/add" method="post" enctype="multipart/form-data">

                  <div class="form-group">


                    <input type="hidden" name="id" id="id" th:value="${session.user.getId()}">



                    <br/>
                    <br/>

                    <div class="form-group">

                      <div class="col-sm-5 col-md-12">
                        <h6 class="modal-title ">请输文章标题</h6>
                        <input type="text" class="form-control" id="title" name="title" placeholder="请输文章标题" th:value="${addPageTmp!=null}? ${addPageTmp.getTitle()}:'' ">
                      </div>


                    </div>
                  </div>



                  <div class="form-group">

                    <div class="col-sm-5 col-md-12">
                      <h6 class="modal-title ">正文</h6>
                      <textarea  class="form-control" id="content" name="content" placeholder="请输入正文内容" th:utext="${addPageTmp!=null}?  ${addPageTmp.getContent()}:'' "></textarea>
                    </div>
                  </div>









                  <script>
                      // 使用自定义配置
                      var editorConfig = {
                          customConfig: '/ckeditor/editorConfig.js'
                      };

                      CKEDITOR.replace( 'content', editorConfig);
                  </script>


                  <br/>


                  <div class="form-group col-md-12">

                    <br/>

                    <div class="col-sm-offset-4 col-sm-5 col-md-12 text-center">


                      <button id="submit_save" type="submit" class="btn btn-default btn-block btn-danger">保存</button>
                      <br/>
                      <a href="/admin"><button id="submit_return"  class="btn btn-default btn-block btn-danger">放弃修改并且返回</button></a>

                    </div>

                    <br/>


                  </div>



                </form>
              </div>


            </div>

          </div>
        </div>





      </div>
    </div>
  </div>
  <!-- 第2栏结束 -->












  <div th:replace="~{import :: down}"></div>



    <div th:replace="~{import :: script}"></div>
      
  </body>
</html>
